package com.example.ffepeg.ffeAdder;

import java.io.IOException;
import java.nio.file.*;
import java.util.List;

public class ResourceExample {

    public static void main(String[] args) {
       String url = "src/main/resources/file/mp/file3.tmp";
       String url1 = "src/main/resources/file/mp/file31.mp4";
        List<String> filesToDelete = List.of(
                url,url1
        );
        //deleteFilesFromList(filesToDelete);
        Fru(filesToDelete);
    }



    private static void Fru(List<String> list){
        StringBuilder dfg = new StringBuilder();
        for (int i = 0; i <list.size(); i++) {
            dfg.append(list.get(i));
        }
        System.err.println(dfg);
    }

    public static void deleteFilesFromList(List<String> filePathStrings) {
        for (String filePathString : filePathStrings) {
            Path path = Paths.get(filePathString);
            try {
                if (Files.exists(path) && Files.isRegularFile(path)) {
                    Files.delete(path);
                    System.out.println("文件删除成功: " + path);
                } else {
                    System.out.println("文件不存在或不是常规文件: " + path);
                }
            } catch (IOException e) {
                System.err.println("文件删除失败: " + path);
                e.printStackTrace();
            }
        }
    }

}
